package library;
import java.util.ArrayList;

public class User {
	
	private String firstName;
	private String surName;
	private String address;
	private ArrayList<Book> booksOnLoan = new ArrayList<Book>();

	public User(String firstName, String surName, String address) {
		this.firstName = firstName;
		this.surName = surName;
		this.address = address;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getSurName() {
		return surName;
	}

	public void setSurName(String surName) {
		this.surName = surName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String toString() {
		return firstName + " " + surName;
	}
	public void addBook(Book book){
		booksOnLoan.add(book);
	}
	public void deleteBook(Book book){
		booksOnLoan.remove(book);
	}
	public ArrayList<Book> getBooks(){
		return booksOnLoan;
	}
	public void printBooks(){
		System.out.print(this);
		System.out.println(" has following books on loan:");
		for (int i = 0; i< booksOnLoan.size(); i++){
		     System.out.println(booksOnLoan.get(i));
		}
	}	
}